package spring;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;

import org.springframework.util.StringUtils;

public class FileSystemXmlAppContext {

	public static void main(String[] args) throws Exception {
		String str="abcde";
		System.out.println(str.substring(2));
		System.out.println(str.substring(1, 2));
		/*Assert.notNull(null, "Location must not be null");
		Assert.hasLength("", "Display name must not be empty");
		Assert.noNullElements(new String[10],"这个对象里面不能有null");
		t1();*/
		t2();
	}
	public static void t1(){
		//把字符串按逗号分号空格分解成数组
		String CONFIG_LOCATION_DELIMITERS = ",; \t\n";
		String[] strs=StringUtils.tokenizeToStringArray("g,a c",CONFIG_LOCATION_DELIMITERS);
		for (String string : strs) {
			System.out.println(string);
		}
	}
	public static void t2() throws IOException{
		URL url=new URL("http://www.bing.com");
		URLConnection uc=url.openConnection();
		InputStream ips=uc.getInputStream();
		byte[] bt=new byte[100];
		while(ips.read()!=-1){
			System.out.println(ips.read());
		}
		System.out.println(uc.getInputStream());
	}

}
